<template>
	<div class="login-container"  style="background: url('http://maizheyou.oss-cn-qingdao.aliyuncs.com/mzy16705d383661.jpg') 50% 50%">

  <el-form ref="AccountFrom"  :model="account" :rules="rules"  label-position="left" label-width="0px"
           class="demo-ruleForm ">
    <h3 class="title" style="text-align: center;">管理员登录</h3>
    <el-form-item prop="username">

      <el-input type="text" v-model="account.userName" auto-complete="off" placeholder="账号"></el-input>
    </el-form-item>
    <el-form-item prop="pwd">
      <el-input type="password"  @keyup.enter.native="handleLogin" v-model="account.password" auto-complete="off" placeholder="密码"></el-input>
    </el-form-item>
    <el-form-item style="width:100%;margin-top:1rem;border:0">
      <el-button type="primary"  class="login"  @click.native.prevent="handleLogin" :loading="logining" >登录</el-button>
    </el-form-item>
  </el-form>

	</div>
</template>


<script>

  import qs from 'qs'
  export default {
  	name:'login',
    data() {
      return {
        logining: false,
        account: {
          userName: '',
          password: ''
        },
        rules: {
          userName: [
            {required: false, message: '请输入账号', trigger: 'blur'}
          ],
          password: [
            {required: false, message: '请输入密码', trigger: 'blur'}
          ]
        },
      };
    },
    mounted() {
        
    },
    methods: {
      handleLogin() {
        console.log(this.account)
        
        this.$api.apiAdminLogin(this.account, res => {
          sessionStorage.setItem('menus', JSON.stringify(res.data.user.menuList))
          sessionStorage.setItem('token', res.data.token)
          this.$router.push('/home')
        })
        
      }
    }
}

</script>

<style rel="stylesheet/scss" lang="scss">
  $bg:#2d3a4b;
  $dark_gray:#889aa4;
  $light_gray:#eee;

  body{
        margin:0;
  }

  .login-container {
    position: fixed;
    height: 100%;
    width:100%;
    background-size:auto;
    input:-webkit-autofill {
      -webkit-box-shadow: 0 0 0px 1000px #293444 inset !important;
      -webkit-text-fill-color: #fff !important;
    }
    .demo-ruleForm{
    	width:20%;
    	margin:0 auto;
    	margin-top:120px;
    }
    input {
      background: transparent;
      border: 0px;
      -webkit-appearance: none;
      border-radius: 0px;
      padding: 12px 5px 12px 15px;
      color: white;
      height: 40px;
    }
    .el-input {
      display: inline-block;
      height: 40px;

    }
    .tips {
      font-size: 14px;
      color: #fff;
      margin-bottom: 10px;
    }
    .svg-container {
      padding: 6px 5px 6px 15px;
      color: $dark_gray;
      vertical-align: middle;
      width: 30px;
      display: inline-block;
      &_login {
        font-size: 20px;
      }
    }
    .title {
      font-size: 26px;
      font-weight: 300;
      color: white;
      margin: 0px auto 40px auto;
      text-align: center;

    }
    .login-form {
      position: absolute;
      left: 0;
      right: 0;
      width: 400px;
      padding: 35px 35px 15px 35px;
      margin: 120px auto;
    }
    .el-form-item {
      border: 1px solid rgba(255, 255, 255, 0.5);

      border-radius: 5px;
      color: #454545;
    }
    .login {
      
      width:100%;border:0;
      background:#0077ed
    }
    .login:hover {
      cursor: pointer;
    }
  }
</style>
